package com.example.sqlitelogin;

import android.content.Intent;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.LinearLayout;
import android.widget.TextView;

import androidx.fragment.app.Fragment;

/**
 * A simple {@link Fragment} subclass.
 * Use the {@link BlankFragment1#newInstance} factory method to
 * create an instance of this fragment.
 */
public class BlankFragment4 extends Fragment {

    private LinearLayout ll1;
    private LinearLayout ll2;
    private LinearLayout ll3;


    private static final String ARG_TEXT = "param1";

    // TODO: Rename and change types of parameters
    private String mTextString;


    View rootView;

    public BlankFragment4() {
        // Required empty public constructor
    }

    /**
     * Use this factory method to create a new instance of
     * this fragment using the provided parameters.
     *
     * @param param1 Parameter 1.

     * @return A new instance of fragment BlankFragment1.
     */
    // TODO: Rename and change types and number of parameters
    public static BlankFragment4 newInstance(String param1) {
        BlankFragment4 fragment = new BlankFragment4();
        Bundle args = new Bundle();
        args.putString(ARG_TEXT, param1);

        fragment.setArguments(args);
        return fragment;
    }

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        if (getArguments() != null) {
            mTextString = getArguments().getString(ARG_TEXT);

        }
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        if(rootView==null){
            rootView= inflater.inflate(R.layout.fragment_blank4, container, false);
        }
        initView();
        return rootView;
    }

    private void initView() {
        TextView textView=rootView.findViewById(R.id.name1);
        textView.setText(mTextString);

        ll2=rootView.findViewById(R.id.ll2);

        ll2.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent8=new Intent(getActivity(),TextGetActivity.class);
                startActivity(intent8);
            }
        });
        ll3=rootView.findViewById(R.id.ll3);

        ll3.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent8=new Intent(getActivity(),WeActivity.class);
                startActivity(intent8);
            }
        });
    }
}